drop table jms_dwd.dwd_leave_message_receive_detail;
CREATE TABLE jms_dwd.dwd_leave_message_receive_detail (
                                                          dt                     date COMMENT '日期',
                                                          leave_message_type tinyint comment '留言类型:1、破损 2、延误 3、遗失 4、其他',
                                                          register_network_type int comment '登记网点类型:1.网点，2.集散，3.中心，4.代理区，5.总部',
                                                          receive_network_type int comment '接受网点类型:1.网点，2.集散，3.中心，4.代理区，5.总部',
                                                          waybill_no varchar(80) comment '运单号',
                                                          create_time datetime comment '创建时间',
                                                          latest_reply_time datetime comment '最新回复时间',
                                                          pick_network_code varchar(80) comment '寄件网点code',
                                                          pick_network_name varchar(80) comment '寄件网点名称',
                                                          register_agent_code varchar(80) comment '登记网点大区code',
                                                          register_agent_name varchar(80) comment '登记网点大区名称',
                                                          register_financial_center_code varchar(80) comment '登记网点代理区code',
                                                          register_financial_center_name varchar(80) comment '登记网点代理区名称',
                                                          register_network_id int comment '登记网点ID',
                                                          register_network_code varchar(80) comment '登记网点编码',
                                                          register_network_name varchar(80) comment '登记网点名称',
                                                          register_person_code varchar(80) comment '登记人编码',
                                                          register_person_name varchar(80) comment '登记人名称',
                                                          receive_agent_code varchar(80) comment '接受网点大区code',
                                                          receive_agent_name varchar(80) comment '接受网点大区名称',
                                                          receive_financial_center_code varchar(80) comment '接受网点代理区code',
                                                          receive_financial_center_name varchar(80) comment '接受网点代理区名称',
                                                          receive_network_id int comment '接收网点ID',
                                                          receive_network_code varchar(80) comment '接收网点CODE',
                                                          receive_network_name varchar(80) comment '接收网点名称',
                                                          reply_content string comment '登记内容',
                                                          is_reply tinyint comment '当前留言是否被回复 1未回复 2已回复',
                                                          create_by_code varchar(80) comment '创建者编码',
                                                          update_by_code varchar(80) comment '更新者编码',
                                                          create_by_name varchar(80) comment '创建人名称',
                                                          update_by_name varchar(80) comment '最后修改人名称',
                                                          update_time datetime comment '更新时间',
                                                          last_reply int comment '最后的回复状态',
                                                          new_content string comment '最新回复内容',
                                                          register_last_reply int comment '登记最后的回复状态',
                                                          receive_last_reply int comment '接受最后的回复状态'

) ENGINE=OLAP
    DUPLICATE KEY(`dt`, `leave_message_type`,`register_network_type`,`receive_network_type`,`waybill_no`)
    COMMENT '留言接受时间明细'
    PARTITION BY RANGE(`dt`)
    (
START ("2022-04-01") END ("2022-05-26") EVERY (INTERVAL 1 day)
    )
    DISTRIBUTED BY HASH(`waybill_no`) BUCKETS 10
    PROPERTIES (
    "replication_num" = "3",
    "dynamic_partition.enable" = "true",
    "dynamic_partition.time_unit" = "DAY",
    "dynamic_partition.start" = "-90",
    "dynamic_partition.end" = "3",
    "dynamic_partition.prefix" = "p",
    "dynamic_partition.buckets" = "10",
    "in_memory" = "false",
    "storage_format" = "V2"
    );